﻿using A2.ERP.IDAL;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace A2.ERP.IBLL
{
    public interface IBaseService<T> where T : class, new()
    {
        IDBSession DbSession { get; }

        IDAL.IBaseDAL<T> CurrentDAL { get; set; }

        IQueryable<T> LoadEntities(System.Linq.Expressions.Expression<Func<T, bool>> whereLambada);

        IQueryable<T> LoadPageEntities<orderT>(int pageIndex, int pageSize, out int totalCount, Expression<Func<T, bool>> wherelamdba, Expression<Func<T, orderT>> orderby, bool isAsc);

        //删除
        bool DeleEntity(T entity);

        //修改
        bool UpdateEntity(T entity, params Expression<Func<T, object>>[] props);

        //添加
        T AddEntity(T entity);
        //存储过程（测试）
        List<T> Procedures<T>(string sql, params SqlParameter[] ps);
    }
}
